package cn.wolfcode.luowowo.article.domain;

import cn.wolfcode.luowowo.common.domain.BaseDomain;
import com.alibaba.fastjson.JSON;
import lombok.*;

import java.util.HashMap;
import java.util.Map;

@Setter
@Getter
@ToString
@AllArgsConstructor
@NoArgsConstructor
//目的地条件查询对象
public class DestinationFilter extends BaseDomain {


    //关联的目的地
    private Destination dest;
    //关联的主题
    private DestinationTheme theme;
    //月份
    private String month;
    //天数
    private String days;

    public String getJsonString() {
        Map<String, Object> map = new HashMap<>();
        map.put("id", id);

        map.put("month", month);
        map.put("days", days);

        if (dest != null) {
            map.put("destName", dest.getName());
            map.put("destId", dest.getId());
        }
        if (theme != null) {
            map.put("themetName", theme.getName());
            map.put("themeId", theme.getId());
        }


        return JSON.toJSONString(map);
    }
}